
using System.Net.Mime;

namespace AugustSql
{
    public class SqlService
    {
        public static SqlInstance Connect(string database, string ipAddress, string primaryKey, string userName="root", string passWord="123456", int port = 3306, ConnectType connectType = ConnectType.MySql)
        {
            SqlInstance sqlInstance = new SqlInstance();
            ISqlClient sqlClient = null;
            if (connectType == ConnectType.MySql)
            {
                sqlClient = new MySQL() { database = database, datasource = ipAddress, password = passWord, userid = userName };
            }
            else if (connectType == ConnectType.SqlServer)
            {
                sqlClient = new SqlServer() { database = database, datasource = ipAddress, password = passWord, userid = userName };
            }
            sqlInstance.sqlClient = sqlClient;
            sqlClient.PrimaryKey = primaryKey;
            return sqlInstance;
        }
    }

}
